export default (url, method, params) => {
	let token = uni.getStorageSync('token');
	let Link = 'http://cw.cwguitar.com/cw-store'
	// let Link = 'http://192.168.1.250:8080/cw-store'
	getApp().globalData.url = Link
	return new Promise((resolve, reject) => {
		uni.request({
			url: Link + url,
			method: method,
			header: {
				'X-Access-Token': token
			},
			data: {
				...params
			},
			success(res) {
				console.log(res, '113');
				resolve(res.data);
				if (res.data.message == " ErrorCode:{code=3000, msg=没有登录} ") {
					uni.showToast({
						title: '登录已过期',
						icon: "none",
						mask: true
					})
					setTimeout(() => {
						uni.clearStorageSync();
						uni.reLaunch({
							url: '/pages/index/index'
						})
					}, 1000)
				}
			},
			fail(err) {
				reject(err);
				console.log(err, '113');
			},
			complete() {}
		});
	});
};